//
//  CeoZhuDingVC.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/4/18.
//  Copyright © 2017年 金橙云. All rights reserved.
//

#import "CeoZhuDingVC.h"

#import "TodoHttpManager.h"
#import "DouDetailsCell.h"
@interface CeoZhuDingVC ()<UITableViewDataSource,UITableViewDelegate>

{
    NSString *str;
    NSString *str1;
    NSString *str2;
    NSString *str3;
    NSString *str4;
    NSString *str5;
    NSString *str6;
    NSString *str7;
}
@property(nonatomic,strong)UITableView *tabView;
@property(nonatomic,strong)NSMutableArray *titArr;
@property(nonatomic,strong)NSMutableArray *houArr;
@property(nonatomic,strong)NSMutableDictionary *Dic;
@end

@implementation CeoZhuDingVC

-(void)viewWillAppear:(BOOL)animated
{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didTDCeoMeZhuDJSM:) name:TDCeoMeZhuDJSM object:nil];
    
    [_manager userCEOZhuDJShuoMingWithID:_pID];
}

-(void)didTDCeoMeZhuDJSM:(NSNotification *)notifi
{
    if (notifi.object != 0)
    {
        _Dic = [notifi.object objectForKey:@"data"];
        
        str = [_Dic objectForKey:@"xsjj"];
        str1 = [_Dic objectForKey:@"lzcj"];
        str2 = [_Dic objectForKey:@"lccj"];
        str3 = [_Dic objectForKey:@"zongjia"];
        str4 = [_Dic objectForKey:@"junjia"];
        str5 = [_Dic objectForKey:@"yijun"];
        str6 = [_Dic objectForKey:@"weijun"];
        str7 = [_Dic objectForKey:@"jun"];

        _houArr = [[NSMutableArray alloc] initWithObjects:str,str1,str2, str3 ,str4,str5,str6,str7, nil];
        

        
        
        
        
        
        
        
        [_tabView reloadData];
        
    }
}
-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:TDCeoMeZhuDJSM object:nil];
}




- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = BgColor;
    self.title = @"定价说明";
    _manager = [TodoHttpManager sharedManager];
    
    _titArr = [NSMutableArray array];
    _houArr = [NSMutableArray array];
    _tabView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, B_WIDTH, B_HEIGHT) style:UITableViewStylePlain];
    _tabView.delegate = self;
    _tabView.dataSource = self;
    _tabView.backgroundColor = BgColor;
    _tabView.rowHeight = 44;
    _tabView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    [self.view addSubview:_tabView];

    _titArr = [[NSMutableArray alloc] initWithObjects:@"销售基价:",@"楼幢差价:",@"楼层差价:",@"楼栋表价总价:",@"楼栋表价均价:",@"已售均价:",@"未售均价",@"综合均价",nil];

    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    
    
    return _titArr.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIndent = @"CellB";
    
    
    DouDetailsCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    if (cell ==nil)
    {
        cell = [[DouDetailsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndent];
        
        
    }
    
    if ([cell isKindOfClass:[DouDetailsCell class]])
    {
        if (_houArr.count !=0)
        {
            
            NSString *str0 = (NSString *)_houArr[indexPath.row];
            cell.secondLab.text = [NSString stringWithFormat:@"%@",str0];
            
            
        }
        
        
    }
    
    cell.firstLab.text = _titArr[indexPath.row];
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//取消点击
    return cell;
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
